<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="Bookmark" href="/favicon.ico">
    <link rel="Shortcut Icon" href="/favicon.ico"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="__PUBLIC__/admin/lib/html5shiv.js"></script>
    <script type="text/javascript" src="__PUBLIC__/admin/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/static/h-ui.admin/css/style.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="__PUBLIC__/admin/lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <script type="text/javascript" src="__PUBLIC__/admin/js/jquery.js"></script>
    <script type="text/javascript" src="__PUBLIC__/admin/js/action.js"></script>
    <title>{$title}</title>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> {$modules} <span
        class="c-gray en">&gt;</span> {$title}
</nav>
<div class="page-container">
    <table class="table table-border table-bordered table-bg">
        <thead>
        <tr class="text-c">
            <th width="40">ID</th>
            <th width="80">活动名称</th>
            <th width="100">姓名</th>
            <th width="40">手机号码</th>
            <th width="40">人数</th>
            <th width="40">预约状态</th>
            <th width="40">申请时间</th>
            <th width="80">操作</th>
        </tr>
        </thead>
        <tbody id="news_option">
        <!-- 遍历 -->
        <volist name="list" id="v">
            <tr class="text-c">
                <td>{$v.id}</td>
                <td>{$v.title}</td>
                <td>{$v.name}</td>
                <td>{$v.mobile}</td>
                <td>{$v.number}</td>
                <td><?php if($v['apply_status']== 3){echo '已拒绝';}elseif($v['apply_status']== 2){echo '已通过';}else{echo '待处理';};?></td>
                <td>{$v.create_at}</td>
                <td>
                    <?php if($v['apply_status']== 1){ ?>
                    <a onclick="applySuc({$v.id})">通过</a> &nbsp;&nbsp;
                    <a onclick="applyFail({$v.id})">拒绝</a>
                    <?php } ?>
                </td>
            </tr>
        </volist>
        <?php if(empty($list)){ ?>
        <tr>
            <td colspan="7" style="text-align: center">暂无数据</td>
        </tr>
        <?php }else{ ?>
        <tr>
            <td colspan="10" class="td_2">
                {$pageObj}
            </td>
        </tr>
        <?php } ?>
        </tbody>
    </table>
</div>
<div id="modal-demo" class="modal fade middle" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content radius">
            <div class="modal-header">
                <h3 class="modal-title">拒绝通过</h3>
                <a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a></div>
            <div class="modal-body">
                <textarea style="width: 100%; height: 100px" id="counselReply">请输入拒绝的原因</textarea>
            </div>
            <div class="modal-footer">
                <button class="btn btn-primary js_confirm">确定</button>
                <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
            </div>
        </div>
    </div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="__PUBLIC__/admin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__PUBLIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/lib/laypage/1.2/laypage.js"></script>
<script>
    var applyId = 0;
    $(function () {
        $('.js_confirm').click(function () {
            var remark = $("#counselReply").val();
            if (applyId > 0)
                $.post("{:U('applyFail')}", {id: applyId, apply_remark: remark}, function (res) {
                    location.reload();
                    if (res.done) {
                        location.reload();
                    } else {
                        $.Huimodalalert('操作失败：' + res.msg, 3000);
                    }
                }, 'json');
            $("#modal-demo").modal("hide");
        });

        $("#counselReply").focus(function () {
            if ($(this).val() == '请输入拒绝的原因') {
                $(this).val('');
            }
        })
    });

    function product_option(page) {
        location.href = "{:U('apply')}?page=" + page;
    }

    function applyFail(id) {
        if(id != applyId){
            $("#counselReply").val('请输入拒绝的原因');
        }
        $("#modal-demo").modal("show");
        applyId = id;
    }

    function applySuc(id) {
        if (confirm('您确定预约通过吗？')) {
            location.href = "{:U('applySuc')}?id=" + id;
        }
        ;
    }
</script>
</body>
</html>
